package com.itheima.controller.user;

import com.itheima.common.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userSetmealController")
@RequestMapping("/setmeal")
public class SetmealController {

    @Autowired
    SetmealService setmealService;

   @PostMapping("/getSetmeal")
    public Result getSetmeal(){

       List<Setmeal> setmealList= setmealService.getSetmeal();
       return new Result(true,"查询成功",setmealList);

   }

   @PostMapping("findById")
    public Result findById(@RequestParam Integer id) {

       Setmeal setmeal = setmealService.findById(id);
       return new Result(true, "查询成功", setmeal);

   }

}
